package com.pktechan.manage.utils;

import java.io.File;

/**
 * 系统常量类，可以添加加载方法，读取配置文件中的配置值
 * <p/>
 * Created by Jiahao Wang on 2016/7/18.
 */
public class SystemConstants {

    public static final String SIGN_COMMA = ",";


    /**
     * 是否枚举型
     */
    public enum YesOrNo {
        NO(0, "0", false, "否"), YES(1, "1", true, "是");

        private int iCode;
        private String strCode;
        private String name;
        private boolean booleanCode;


        YesOrNo(int iCode, String strCode, boolean booleanCode, String name) {
            this.iCode = iCode;
            this.strCode = strCode;
            this.name = name;
            this.booleanCode = booleanCode;
        }

        public static YesOrNo getByICode(Integer code) {
            for (YesOrNo yesOrNo : YesOrNo.values()) {
                if (yesOrNo.getICode() == code) {
                    return yesOrNo;
                }
            }
            return null;
        }

        public static String getByStrCode(String code) {
            for (YesOrNo yesOrNo : YesOrNo.values()) {
                if (yesOrNo.strCode.equals(code) ) {
                    return yesOrNo.name;
                }
            }
            return null;
        }

        public static String getNameByICode(Integer code) {
            for (YesOrNo yesOrNo : YesOrNo.values()) {
                if (yesOrNo.getICode() == code ) {
                    return yesOrNo.name;
                }
            }
            return null;
        }

        public int getICode() {
            return iCode;
        }

        public String getStrCode() {
            return strCode;
        }

        public boolean getBooleanCode() {
            return booleanCode;
        }

        public String getName() {
            return name;
        }
    }





}
